import React, { Component } from 'react';
import { Text, Image, View, TextInput, TouchableOpacity, ScrollView } from 'react-native';
import { unitWidth } from '../constants/AdapterUtil';
import { MyHeader } from '../components/MyHeader';
import Colors from '../constants/Colors';
import { postFetch } from '../constants/HttpExtension';
import { show } from '../constants/Toast';
import { api_member_info_Certification, api_member_info_companyRealname, api_member_info_company } from '../constants/HttpServices';
import { SubmitButton1 } from '../components/Button';
import { MyInput1 } from '../components/Input';
import TextUtil from '../constants/TextUtil';
import { ChooseSingleImageItem, TextItem, TitleMultiplyImageItem, TitleTextItem } from '../components/Item';
import { LoadingAndPorgressModal } from '../components/Modal';
import { uploadFile } from '../constants/UpLoadHelper';
import { ExamineView } from '../components/EmptyView';
import CommonUtil from '../constants/CommonUtil';

export default class ShowSDRZScreen extends Component {

    constructor(props) {
        super(props)

        const { navigation } = this.props;
        this.id = navigation.getParam('id', -1)
        this.state = {
            list1: [],
            list2: [],
            list3: [],
            list4: [],
            info: {},
        }
    }

    componentDidMount() {
        this.getData()
    }

    componentWillUnmount() {

    };

    render() {
        return (
            <View style={{ flex: 1, backgroundColor: Colors.colorEF }}>
                <MyHeader title='实地认证' leftImg={require('../res/ic_arrow_left.png')} leftClick={() => { this.props.navigation.pop() }} />
                <ScrollView style={{ flex: 1 }} showsVerticalScrollIndicator={false}>
                    <View>
                        <TextItem title='营业地址：' value={this.state.info.business_address} />
                        <TitleMultiplyImageItem title='各部门员工情况' ImageList={this.state.list1} />
                        <TitleTextItem title='生产能力及质量管理：' value={this.state.info.productive_power} />
                        <TitleTextItem title='技术水平及生产开发能力：' value={this.state.info.technical_level} />
                        <TitleMultiplyImageItem title='各类证书原件' ImageList={this.state.list2} />
                        <TitleMultiplyImageItem title='企业实地照片' ImageList={this.state.list3} />
                        <TitleMultiplyImageItem title='股东合影' ImageList={this.state.list4} />
                    </View>
                </ScrollView>
            </View>
        );
    }

    getData() {
        let params = {
            id: this.id
        }
        postFetch(api_member_info_company, params, {
            success: (response) => {
                this.setState({
                    info: response.result.on_the_spot_info,
                    list1: JSON.parse(response.result.on_the_spot_info.staff),
                    list2: JSON.parse(response.result.on_the_spot_info.original_certificate),
                    list3: JSON.parse(response.result.on_the_spot_info.indeed_photos),
                    list4: JSON.parse(response.result.on_the_spot_info.stockholder),
                })
            },
            fail: (response) => {
                show(response.result.message);
            }
        })
    }
}